package me.softwareengineer.guice.rendering.listener;

import me.softwareengineer.guice.rendering.domain.RawElement;
import me.softwareengineer.guice.rendering.domain.Syntax;

/**
 * Called to notify that about raw content. Raw content shouldn't be parsed or
 * modified and that should be injected as is in any output. The content depends
 * on a syntax and listeners decide if they can handle that syntax or not. For
 * example if it's in "xhtml/1.0" syntax then the XHTML Renderer can insert it
 * directly in the XHTML output.
 * 
 * @author yadtahir
 * @see RawElement <pre>
 * This class is thread-safe and immutable.
 * </pre>
 */
public class OnRawEvent extends Event implements OnElementEvent {

	/**
	 * @see #getRawContent()
	 */
	private String rawContent;

	/**
	 * The syntax of the raw data
	 */
	private Syntax syntax;

	/**
	 * Constructs an on raw event.
	 * 
	 * @param syntax
	 *            the syntax of the content.
	 * @param content
	 *            the content of the element.
	 */
	public OnRawEvent(Syntax syntax, String content) {
		this.syntax = syntax;
		this.rawContent = content;
	}

	/**
	 * 
	 * @return the content of the element
	 */
	public String getRawContent() {
		return rawContent;
	}

	/**
	 * 
	 * @return the syntax of the content
	 * @see Syntax
	 */
	public Syntax getSyntax() {
		return this.syntax;
	}

}
